<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head lang="zh-CN">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="js/jquery-1.7.2.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
      <script src="js/jquery.validate.min.js"></script>
    <script src="js/messages_zh.js"></script>
<title>Insert title here</title>
<style type="text/css">
	#msg{
		display: none;
	}
</style>
</head>
<script type="text/javascript">
	$(function(){
		$("#sub").click(function(){
			var role = $("input[name='role']:checked").val();
			var username = $("#username").val();
			var userpsw = $("#userpsw").val();
			$.ajax({
				type:'post',
				url:'userlogin',
				data:{"username":username,
					"userpsw":userpsw,
					"role":role,
				},
				dataType:'json',
				success:function(data){
					if(data=="1"){
						location.href="enterusermain"
					}
					else if(data=="2"){
						location.href="entermain"
					}
					else{
						$("#msg").show();
					}
				}
			});
		});
	});
	
</script>
<body>
<div style="width:100%;heigth:200px">
 <div style="background-color:#fff"><img alt="加载失败" src="img/logo.png" style="width:200px;height:150px"/></div>
  <div style="float:right; margin-top: 8px;padding-left: 20px;padding-right: 20px" ><a href="login.jsp">登录</a></div>
   <div style="float:right;margin-top: 8px;padding-left: 20px;padding-right: 20px"><a href="regist.jsp">注册</a></div>
    <div style="float:right;margin-top: 8px;padding-left: 20px;padding-right: 20px"><a href="sellerregist.jsp">申请店铺</a></div>
 </div> 
	<div class="container">
	<hr>
		<div class="row">
			<div class="col-md-1"></div>
			<div class="col-md-6">
				<!-- 登陆界面 -->
				<div class="loginForm" style="margin-top: 100px">
				
						<div class="form-group">
							<label>用户名</label> <input type="text" id="username" class="form-control"
								name="username" style="width:258px"  placeholder="请输入账号、手机号">
								
						</div>
						<div class="form-group">
							<label>密码</label> <input type="password" id="userpsw" class="form-control"
								name="userpsw" style="width:258px"  placeholder="请输入密码">
								
					
				</div>
				<div class="form-group">
							 <input type="radio" id="role" 
								name="role" style="width:20x" value="用户" checked="checked">用户
								 <input type="radio" id="role"
								name="role" style="width:20px" value="商家">商家
								<br>
								<span id="msg" style="font-size: 12px;color: red">密码错误，可以试试<a href="#">找回密码</a></span>
								<br>
							<button  class="btn btn-default" id="sub">登陆</button>
						</div>
			</div>
			<div class="col-md-5"></div>
		</div>
	</div>
</body>
</html>